package com.controller.api;

import com.biz.ActPhotoUrlBiz;
import com.biz.CustomerBiz;
import com.biz.JoinVipBiz;
import com.biz.ShareVipBiz;
import com.controller.backend.BaseController;
import com.core.Result;
import com.core.ResultGenerator;
import com.entity.model.*;
import net.sf.jsqlparser.statement.select.Join;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import tk.mybatis.mapper.entity.Condition;

import java.util.List;

/**
* Created by jc on 2019/11/16.
*/
@RestController("apiShareVipController")
@RequestMapping("/api/shareVip")
public class shareVipController extends BaseController<ShareVip>{
    @Autowired
    private ShareVipBiz shareVipBiz;

    @Autowired
    private JoinVipBiz joinVipBiz;

    @Autowired
    private CustomerBiz customerBiz;


    @RequestMapping(value = "/shareVipInfo")
    public Result list() {
        Condition condition=new Condition(ShareVip.class);
        condition.createCriteria().andEqualTo("id",1);
        ShareVip shareVip = shareVipBiz.findByCondition(condition).get(0);
        return ResultGenerator.genSuccessResult(shareVip);
    }

    @RequestMapping(value = "/shareVipCustomerInfo")
    public Result shareVipCustomerInfo(@RequestParam  Integer shareCustomerId)  {
        Condition condition=new Condition(Customer.class);
        condition.createCriteria().andEqualTo("id",shareCustomerId);
        Customer customer = customerBiz.findByCondition(condition).get(0);
        return ResultGenerator.genSuccessResult(customer);
    }


    @RequestMapping(value = "/joinVipInfo")
    public Result joinVipInfo() {
        Condition condition=new Condition(JoinVip.class);
        condition.createCriteria().andEqualTo("id",1);
        JoinVip joinVip = joinVipBiz.findByCondition(condition).get(0);
        return ResultGenerator.genSuccessResult(joinVip);
    }
}
